package com.burstly.lib.component.networkcomponent.burstly.html.ormma;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.burstly.lib.component.networkcomponent.burstly.html.ormma.util.NavigationStringEnum;
import com.burstly.lib.component.networkcomponent.burstly.html.ormma.util.TransitionStringEnum;
import com.burstly.lib.util.LoggerExt;
import java.lang.reflect.Field;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class OrmmaController
{
  private static final String BOOLEAN_TYPE = "boolean";
  private static final String EXIT = "exit";
  private static final String FLOAT_TYPE = "float";
  private static final String FULL_SCREEN = "fullscreen";
  private static final String INT_TYPE = "int";
  private static final LoggerExt LOG = LoggerExt.getInstance();
  private static final String NAVIGATION_TYPE = "class com.ormma.NavigationStringEnum";
  private static final String STRING_TYPE = "class java.lang.String";
  private static final String STYLE_NORMAL = "normal";
  private static final String TAG = "OrmmaController";
  private static final String TRANSITION_TYPE = "class com.ormma.TransitionStringEnum";
  protected Context mContext;
  protected OrmmaView mOrmmaView;

  public OrmmaController(OrmmaView paramOrmmaView, Context paramContext)
  {
    this.mOrmmaView = paramOrmmaView;
    this.mContext = paramContext;
  }

  protected static Object getFromJSON(JSONObject paramJSONObject, Class<?> paramClass)
    throws IllegalAccessException, InstantiationException, NumberFormatException, NullPointerException
  {
    Field[] arrayOfField = paramClass.getDeclaredFields();
    Object localObject = paramClass.newInstance();
    int i = 0;
    while (true)
      if (i < arrayOfField.length)
      {
        Field localField = arrayOfField[i];
        String str1 = localField.getName().replace('_', '-');
        String str2 = localField.getType().toString();
        try
        {
          if (str2.equals("int"))
          {
            str3 = paramJSONObject.getString(str1).toLowerCase();
            boolean bool = str3.startsWith("#");
            if (bool)
            {
              j = -1;
              try
              {
                int m;
                if (str3.startsWith("#0x"))
                  m = Integer.decode(str3.substring(1)).intValue();
                int k;
                for (j = m; ; j = k)
                {
                  localField.set(localObject, Integer.valueOf(j));
                  i++;
                  break;
                  k = Integer.parseInt(str3.substring(1), 16);
                }
              }
              catch (NumberFormatException localNumberFormatException)
              {
                while (true)
                  LOG.logThrowable("OrmmaController", localNumberFormatException);
              }
            }
          }
        }
        catch (JSONException localJSONException)
        {
          while (true)
          {
            String str3;
            LoggerExt localLoggerExt = LOG;
            Object[] arrayOfObject = new Object[1];
            arrayOfObject[0] = localJSONException.getMessage();
            localLoggerExt.logInfo("OrmmaController", "No property in params: {0}", arrayOfObject);
            continue;
            int j = Integer.parseInt(str3);
            continue;
            if (str2.equals("class java.lang.String"))
              localField.set(localObject, paramJSONObject.getString(str1));
            else if (str2.equals("boolean"))
              localField.set(localObject, Boolean.valueOf(paramJSONObject.getBoolean(str1)));
            else if (str2.equals("float"))
              localField.set(localObject, Float.valueOf(Float.parseFloat(paramJSONObject.getString(str1))));
            else if (str2.equals("class com.ormma.NavigationStringEnum"))
              localField.set(localObject, NavigationStringEnum.fromString(paramJSONObject.getString(str1)));
            else if (str2.equals("class com.ormma.TransitionStringEnum"))
              localField.set(localObject, TransitionStringEnum.fromString(paramJSONObject.getString(str1)));
          }
        }
      }
    return localObject;
  }

  public abstract void stopAllListeners();

  public static class Dimensions extends OrmmaController.ReflectedParcelable
  {
    public static final Parcelable.Creator<Dimensions> CREATOR = new Parcelable.Creator()
    {
      public OrmmaController.Dimensions createFromParcel(Parcel paramAnonymousParcel)
      {
        return new OrmmaController.Dimensions(paramAnonymousParcel);
      }

      public OrmmaController.Dimensions[] newArray(int paramAnonymousInt)
      {
        return new OrmmaController.Dimensions[paramAnonymousInt];
      }
    };
    public int height;
    public int width;
    public int x;
    public int y;

    public Dimensions()
    {
      this.x = -1;
      this.y = -1;
      this.width = -1;
      this.height = -1;
    }

    protected Dimensions(Parcel paramParcel)
    {
      super();
    }
  }

  public static class PlayerProperties extends OrmmaController.ReflectedParcelable
  {
    public static final Parcelable.Creator<PlayerProperties> CREATOR = new Parcelable.Creator()
    {
      public OrmmaController.PlayerProperties createFromParcel(Parcel paramAnonymousParcel)
      {
        return new OrmmaController.PlayerProperties(paramAnonymousParcel);
      }

      public OrmmaController.PlayerProperties[] newArray(int paramAnonymousInt)
      {
        return new OrmmaController.PlayerProperties[paramAnonymousInt];
      }
    };
    private boolean mAudioMuted;
    private boolean mAutoPlay;
    private boolean mDoLoop;
    private boolean mInline;
    private boolean mShowControl;
    private String mStartStyle;
    private String mStopStyle;

    public PlayerProperties()
    {
      this.mAutoPlay = true;
      this.mShowControl = true;
      this.mDoLoop = false;
      this.mAudioMuted = false;
      this.mStartStyle = "normal";
      this.mStopStyle = "normal";
    }

    public PlayerProperties(Parcel paramParcel)
    {
      super();
    }

    public boolean exitOnComplete()
    {
      return this.mStopStyle.equalsIgnoreCase("exit");
    }

    public boolean isAudioMuted()
    {
      return this.mAudioMuted;
    }

    public boolean isAutoPlay()
    {
      return this.mAutoPlay;
    }

    public boolean isDoLoop()
    {
      return this.mDoLoop;
    }

    public boolean isFullScreen()
    {
      return this.mStartStyle.equalsIgnoreCase("fullscreen");
    }

    public boolean isInline()
    {
      return this.mInline;
    }

    public boolean isShowControl()
    {
      return this.mShowControl;
    }

    public void muteAudio()
    {
      this.mAudioMuted = true;
    }

    public void setProperties(boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3, boolean paramBoolean4, boolean paramBoolean5, String paramString1, String paramString2)
    {
      this.mAutoPlay = paramBoolean2;
      this.mShowControl = paramBoolean3;
      this.mInline = paramBoolean4;
      this.mDoLoop = paramBoolean5;
      this.mAudioMuted = paramBoolean1;
      this.mStartStyle = paramString1;
      this.mStopStyle = paramString2;
    }

    public void setStartStyle(String paramString)
    {
      this.mStartStyle = paramString;
    }

    public void setStopStyle(String paramString)
    {
      this.mStopStyle = paramString;
    }
  }

  public static class Properties extends OrmmaController.ReflectedParcelable
  {
    public static final Parcelable.Creator<Properties> CREATOR = new Parcelable.Creator()
    {
      public OrmmaController.Properties createFromParcel(Parcel paramAnonymousParcel)
      {
        return new OrmmaController.Properties(paramAnonymousParcel);
      }

      public OrmmaController.Properties[] newArray(int paramAnonymousInt)
      {
        return new OrmmaController.Properties[paramAnonymousInt];
      }
    };
    public int backgroundColor;
    public float backgroundOpacity;
    public int height;
    public boolean isModal;
    public boolean lockOrientation;
    public boolean useBackground;
    public boolean useCusomClose;
    public int width;

    public Properties()
    {
      this.useBackground = false;
      this.backgroundColor = 0;
      this.backgroundOpacity = 0.0F;
    }

    protected Properties(Parcel paramParcel)
    {
      super();
    }
  }

  public static class ReflectedParcelable
    implements Parcelable
  {
    public ReflectedParcelable()
    {
    }

    protected ReflectedParcelable(Parcel paramParcel)
    {
      Field[] arrayOfField = getClass().getDeclaredFields();
      for (int i = 0; ; i++)
        try
        {
          if (i < arrayOfField.length)
          {
            localField = arrayOfField[i];
            Class localClass = localField.getType();
            if (!localClass.isEnum())
              break label112;
            String str = localClass.toString();
            if (str.equals("class com.ormma.NavigationStringEnum"))
              localField.set(this, NavigationStringEnum.fromString(paramParcel.readString()));
            else if (str.equals("class com.ormma.TransitionStringEnum"))
              localField.set(this, TransitionStringEnum.fromString(paramParcel.readString()));
          }
        }
        catch (IllegalArgumentException localIllegalArgumentException)
        {
          Field localField;
          OrmmaController.LOG.logThrowable("OrmmaController", localIllegalArgumentException);
          return;
          if (!(localField.get(this) instanceof Parcelable.Creator))
            localField.set(this, paramParcel.readValue(null));
        }
        catch (IllegalAccessException localIllegalAccessException)
        {
          label112: OrmmaController.LOG.logThrowable("OrmmaController", localIllegalAccessException);
          return;
        }
    }

    public int describeContents()
    {
      return 0;
    }

    public void writeToParcel(Parcel paramParcel, int paramInt)
    {
      Field[] arrayOfField = getClass().getDeclaredFields();
      for (int i = 0; ; i++)
        try
        {
          if (i < arrayOfField.length)
          {
            localField = arrayOfField[i];
            Class localClass = localField.getType();
            if (!localClass.isEnum())
              break label117;
            String str = localClass.toString();
            if (str.equals("class com.ormma.NavigationStringEnum"))
              paramParcel.writeString(((NavigationStringEnum)localField.get(this)).getText());
            else if (str.equals("class com.ormma.TransitionStringEnum"))
              paramParcel.writeString(((TransitionStringEnum)localField.get(this)).getText());
          }
        }
        catch (IllegalArgumentException localIllegalArgumentException)
        {
          Field localField;
          OrmmaController.LOG.logThrowable("OrmmaController", localIllegalArgumentException);
          return;
          Object localObject = localField.get(this);
          if (!(localObject instanceof Parcelable.Creator))
            paramParcel.writeValue(localObject);
        }
        catch (IllegalAccessException localIllegalAccessException)
        {
          label117: OrmmaController.LOG.logThrowable("OrmmaController", localIllegalAccessException);
          return;
        }
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.burstly.html.ormma.OrmmaController
 * JD-Core Version:    0.6.2
 */